set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/antlr4-runtime)

set (SRCS
    ${LIBRARY_DIR}/ANTLRErrorListener.cpp
    ${LIBRARY_DIR}/ANTLRErrorStrategy.cpp
    ${LIBRARY_DIR}/ANTLRFileStream.cpp
    ${LIBRARY_DIR}/ANTLRInputStream.cpp
    ${LIBRARY_DIR}/atn/AbstractPredicateTransition.cpp
    ${LIBRARY_DIR}/atn/ActionTransition.cpp
    ${LIBRARY_DIR}/atn/AmbiguityInfo.cpp
    ${LIBRARY_DIR}/atn/ArrayPredictionContext.cpp
    ${LIBRARY_DIR}/atn/ATN.cpp
    ${LIBRARY_DIR}/atn/ATNConfig.cpp
    ${LIBRARY_DIR}/atn/ATNConfigSet.cpp
    ${LIBRARY_DIR}/atn/ATNDeserializationOptions.cpp
    ${LIBRARY_DIR}/atn/ATNDeserializer.cpp
    ${LIBRARY_DIR}/atn/ATNSerializer.cpp
    ${LIBRARY_DIR}/atn/ATNSimulator.cpp
    ${LIBRARY_DIR}/atn/ATNState.cpp
    ${LIBRARY_DIR}/atn/AtomTransition.cpp
    ${LIBRARY_DIR}/atn/BasicBlockStartState.cpp
    ${LIBRARY_DIR}/atn/BasicState.cpp
    ${LIBRARY_DIR}/atn/BlockEndState.cpp
    ${LIBRARY_DIR}/atn/BlockStartState.cpp
    ${LIBRARY_DIR}/atn/ContextSensitivityInfo.cpp
    ${LIBRARY_DIR}/atn/DecisionEventInfo.cpp
    ${LIBRARY_DIR}/atn/DecisionInfo.cpp
    ${LIBRARY_DIR}/atn/DecisionState.cpp
    ${LIBRARY_DIR}/atn/EmptyPredictionContext.cpp
    ${LIBRARY_DIR}/atn/EpsilonTransition.cpp
    ${LIBRARY_DIR}/atn/ErrorInfo.cpp
    ${LIBRARY_DIR}/atn/LexerAction.cpp
    ${LIBRARY_DIR}/atn/LexerActionExecutor.cpp
    ${LIBRARY_DIR}/atn/LexerATNConfig.cpp
    ${LIBRARY_DIR}/atn/LexerATNSimulator.cpp
    ${LIBRARY_DIR}/atn/LexerChannelAction.cpp
    ${LIBRARY_DIR}/atn/LexerCustomAction.cpp
    ${LIBRARY_DIR}/atn/LexerIndexedCustomAction.cpp
    ${LIBRARY_DIR}/atn/LexerModeAction.cpp
    ${LIBRARY_DIR}/atn/LexerMoreAction.cpp
    ${LIBRARY_DIR}/atn/LexerPopModeAction.cpp
    ${LIBRARY_DIR}/atn/LexerPushModeAction.cpp
    ${LIBRARY_DIR}/atn/LexerSkipAction.cpp
    ${LIBRARY_DIR}/atn/LexerTypeAction.cpp
    ${LIBRARY_DIR}/atn/LL1Analyzer.cpp
    ${LIBRARY_DIR}/atn/LookaheadEventInfo.cpp
    ${LIBRARY_DIR}/atn/LoopEndState.cpp
    ${LIBRARY_DIR}/atn/NotSetTransition.cpp
    ${LIBRARY_DIR}/atn/OrderedATNConfigSet.cpp
    ${LIBRARY_DIR}/atn/ParseInfo.cpp
    ${LIBRARY_DIR}/atn/ParserATNSimulator.cpp
    ${LIBRARY_DIR}/atn/PlusBlockStartState.cpp
    ${LIBRARY_DIR}/atn/PlusLoopbackState.cpp
    ${LIBRARY_DIR}/atn/PrecedencePredicateTransition.cpp
    ${LIBRARY_DIR}/atn/PredicateEvalInfo.cpp
    ${LIBRARY_DIR}/atn/PredicateTransition.cpp
    ${LIBRARY_DIR}/atn/PredictionContext.cpp
    ${LIBRARY_DIR}/atn/PredictionMode.cpp
    ${LIBRARY_DIR}/atn/ProfilingATNSimulator.cpp
    ${LIBRARY_DIR}/atn/RangeTransition.cpp
    ${LIBRARY_DIR}/atn/RuleStartState.cpp
    ${LIBRARY_DIR}/atn/RuleStopState.cpp
    ${LIBRARY_DIR}/atn/RuleTransition.cpp
    ${LIBRARY_DIR}/atn/SemanticContext.cpp
    ${LIBRARY_DIR}/atn/SetTransition.cpp
    ${LIBRARY_DIR}/atn/SingletonPredictionContext.cpp
    ${LIBRARY_DIR}/atn/StarBlockStartState.cpp
    ${LIBRARY_DIR}/atn/StarLoopbackState.cpp
    ${LIBRARY_DIR}/atn/StarLoopEntryState.cpp
    ${LIBRARY_DIR}/atn/TokensStartState.cpp
    ${LIBRARY_DIR}/atn/Transition.cpp
    ${LIBRARY_DIR}/atn/WildcardTransition.cpp
    ${LIBRARY_DIR}/BailErrorStrategy.cpp
    ${LIBRARY_DIR}/BaseErrorListener.cpp
    ${LIBRARY_DIR}/BufferedTokenStream.cpp
    ${LIBRARY_DIR}/CharStream.cpp
    ${LIBRARY_DIR}/CommonToken.cpp
    ${LIBRARY_DIR}/CommonTokenFactory.cpp
    ${LIBRARY_DIR}/CommonTokenStream.cpp
    ${LIBRARY_DIR}/ConsoleErrorListener.cpp
    ${LIBRARY_DIR}/DefaultErrorStrategy.cpp
    ${LIBRARY_DIR}/dfa/DFA.cpp
    ${LIBRARY_DIR}/dfa/DFASerializer.cpp
    ${LIBRARY_DIR}/dfa/DFAState.cpp
    ${LIBRARY_DIR}/dfa/LexerDFASerializer.cpp
    ${LIBRARY_DIR}/DiagnosticErrorListener.cpp
    ${LIBRARY_DIR}/Exceptions.cpp
    ${LIBRARY_DIR}/FailedPredicateException.cpp
    ${LIBRARY_DIR}/InputMismatchException.cpp
    ${LIBRARY_DIR}/InterpreterRuleContext.cpp
    ${LIBRARY_DIR}/IntStream.cpp
    ${LIBRARY_DIR}/Lexer.cpp
    ${LIBRARY_DIR}/LexerInterpreter.cpp
    ${LIBRARY_DIR}/LexerNoViableAltException.cpp
    ${LIBRARY_DIR}/ListTokenSource.cpp
    ${LIBRARY_DIR}/misc/InterpreterDataReader.cpp
    ${LIBRARY_DIR}/misc/Interval.cpp
    ${LIBRARY_DIR}/misc/IntervalSet.cpp
    ${LIBRARY_DIR}/misc/MurmurHash.cpp
    ${LIBRARY_DIR}/misc/Predicate.cpp
    ${LIBRARY_DIR}/NoViableAltException.cpp
    ${LIBRARY_DIR}/Parser.cpp
    ${LIBRARY_DIR}/ParserInterpreter.cpp
    ${LIBRARY_DIR}/ParserRuleContext.cpp
    ${LIBRARY_DIR}/ProxyErrorListener.cpp
    ${LIBRARY_DIR}/RecognitionException.cpp
    ${LIBRARY_DIR}/Recognizer.cpp
    ${LIBRARY_DIR}/RuleContext.cpp
    ${LIBRARY_DIR}/RuleContextWithAltNum.cpp
    ${LIBRARY_DIR}/RuntimeMetaData.cpp
    ${LIBRARY_DIR}/support/Any.cpp
    ${LIBRARY_DIR}/support/Arrays.cpp
    ${LIBRARY_DIR}/support/CPPUtils.cpp
    ${LIBRARY_DIR}/support/guid.cpp
    ${LIBRARY_DIR}/support/StringUtils.cpp
    ${LIBRARY_DIR}/Token.cpp
    ${LIBRARY_DIR}/TokenSource.cpp
    ${LIBRARY_DIR}/TokenStream.cpp
    ${LIBRARY_DIR}/TokenStreamRewriter.cpp
    ${LIBRARY_DIR}/tree/ErrorNode.cpp
    ${LIBRARY_DIR}/tree/ErrorNodeImpl.cpp
    ${LIBRARY_DIR}/tree/IterativeParseTreeWalker.cpp
    ${LIBRARY_DIR}/tree/ParseTree.cpp
    ${LIBRARY_DIR}/tree/ParseTreeListener.cpp
    ${LIBRARY_DIR}/tree/ParseTreeVisitor.cpp
    ${LIBRARY_DIR}/tree/ParseTreeWalker.cpp
    ${LIBRARY_DIR}/tree/pattern/Chunk.cpp
    ${LIBRARY_DIR}/tree/pattern/ParseTreeMatch.cpp
    ${LIBRARY_DIR}/tree/pattern/ParseTreePattern.cpp
    ${LIBRARY_DIR}/tree/pattern/ParseTreePatternMatcher.cpp
    ${LIBRARY_DIR}/tree/pattern/RuleTagToken.cpp
    ${LIBRARY_DIR}/tree/pattern/TagChunk.cpp
    ${LIBRARY_DIR}/tree/pattern/TextChunk.cpp
    ${LIBRARY_DIR}/tree/pattern/TokenTagToken.cpp
    ${LIBRARY_DIR}/tree/TerminalNode.cpp
    ${LIBRARY_DIR}/tree/TerminalNodeImpl.cpp
    ${LIBRARY_DIR}/tree/Trees.cpp
    ${LIBRARY_DIR}/tree/xpath/XPath.cpp
    ${LIBRARY_DIR}/tree/xpath/XPathElement.cpp
    ${LIBRARY_DIR}/tree/xpath/XPathLexer.cpp
    ${LIBRARY_DIR}/tree/xpath/XPathLexerErrorListener.cpp
    ${LIBRARY_DIR}/tree/xpath/XPathRuleAnywhereElement.cpp
    ${LIBRARY_DIR}/tree/xpath/XPathRuleElement.cpp
    ${LIBRARY_DIR}/tree/xpath/XPathTokenAnywhereElement.cpp
    ${LIBRARY_DIR}/tree/xpath/XPathTokenElement.cpp
    ${LIBRARY_DIR}/tree/xpath/XPathWildcardAnywhereElement.cpp
    ${LIBRARY_DIR}/tree/xpath/XPathWildcardElement.cpp
    ${LIBRARY_DIR}/UnbufferedCharStream.cpp
    ${LIBRARY_DIR}/UnbufferedTokenStream.cpp
    ${LIBRARY_DIR}/Vocabulary.cpp
    ${LIBRARY_DIR}/WritableToken.cpp
)

add_library (antlr4-runtime ${SRCS})

target_include_directories (antlr4-runtime SYSTEM PUBLIC ${LIBRARY_DIR})
